/*
 * Copyright (c) United Binary LLC.  All rights reserved.
 * 
 * This code is licensed under the MIT License
 * 
 * SEE: http://harnessit.codeplex.com/license
 * 
 */
using System;
using System.ComponentModel;

namespace UnitedBinary.UnitTests.Framework
{
	#region TestOrderModes Enumeration
	/// <include file='comments.xml' path='Docs/TestOrderModes/Class/*'/>
	[Serializable]
	public enum TestOrderModes 
	{
		/// <include file='comments.xml' path='Docs/TestOrderModes/First/*'/>
		First, 
		/// <include file='comments.xml' path='Docs/TestOrderModes/Last/*'/>
		Last, 
		/// <include file='comments.xml' path='Docs/TestOrderModes/Neutral/*'/>
		Neutral
	};
	#endregion

	/// <include file='comments.xml' path='Docs/TestOrderAttribute/Class/*'/>
	[Serializable]
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
	public sealed class TestOrderAttribute : System.Attribute
	{
		#region Member Variables
		private TestOrderModes mode;
		private int suborder;
		#endregion

		#region Construction
		/// <include file='comments.xml' path='Docs/TestOrderAttribute/ctor_TestOrderModes/*'/>
		public TestOrderAttribute(TestOrderModes mode)
		{
			this.mode = mode;

			if (mode == TestOrderModes.First)
			{
				this.suborder = int.MaxValue;
			}
			else if (mode == TestOrderModes.Last)
			{
				this.suborder = int.MinValue;
			}
			else
			{
				this.suborder = 100;
			}
		}

		/// <include file='comments.xml' path='Docs/TestOrderAttribute/ctor_TestOrderModes_int/*'/>
		public TestOrderAttribute(TestOrderModes mode, int suborder)
		{
			this.mode = mode;
			this.suborder = suborder;
		}

		/// <include file='comments.xml' path='Docs/TestOrderAttribute/ctor_string_TestOrderModes/*'/>
		[Obsolete("Please apply descriptions to the TestMethod and use one of the overloaded TestOrder attributes which does not specify a description.")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public TestOrderAttribute(string description, TestOrderModes mode) : this(mode)
		{
		}

		/// <include file='comments.xml' path='Docs/TestOrderAttribute/ctor_string_TestOrderModes_int/*'/>
		[Obsolete("Please apply descriptions to the TestMethod and use one of the overloaded TestOrder attributes which does not specify a description.")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public TestOrderAttribute(string description, TestOrderModes mode, int suborder) : this(mode, suborder)
		{
		}
		#endregion

		#region Data Access Properties
		/*/// <include file='comments.xml' path='Docs/TestOrderAttribute/Description/*'/>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public string Description
		{
			get
			{
				return description;
			}
		}  */

		/// <include file='comments.xml' path='Docs/TestOrderAttribute/Mode/*'/>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public TestOrderModes Mode
		{
			get
			{
				return mode;
			}
		}

		/// <include file='comments.xml' path='Docs/TestOrderAttribute/SubModeOrder/*'/>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public int SubModeOrder
		{
			get
			{
				return suborder;
			}
		}
		#endregion
	}
}
